package org.example.compare.dto;

import lombok.Data;

import java.util.ArrayList;
import java.util.List;

@Data
public class CBoxSet {
    List<Long> mBoxID = new ArrayList<>();//暂时保留这两个
    List<String> mBoxNum = new ArrayList<>();//暂时保留这两个
    int miBoxCnt; //筐数
    int miCutCnt; //裁片件数

    public void clear() {
        miBoxCnt = 0;
        miCutCnt = 0;
        //mBox.clear();
        mBoxID.clear();
        mBoxNum.clear();
    }

    public void put(SBoxData pBox) {
        if ((pBox != null) && (!mBoxNum.contains(pBox.getMBoxNum()))) {
            //mBox.add(pBox);
            mBoxID.add(pBox.miBoxRecordId);
            mBoxNum.add(pBox.mBoxNum);
            miBoxCnt++;
            miCutCnt += pBox.miPlanCnt;
        }
    }

    public void pop(SBoxData pBox) {
        if ((pBox != null) && (mBoxNum.contains(pBox.getMBoxNum()))) {
            miBoxCnt--;
            miCutCnt -= pBox.miPlanCnt;
            //mBox.remove(pBox);
            mBoxID.remove(pBox.miBoxRecordId);
            mBoxNum.remove(pBox.mBoxNum);
        }
    }

    public boolean isInSide(String vBoxNum) {
        return mBoxNum.contains(vBoxNum);
    }

    public boolean isInSide(long vBoxRecordId) {
        return mBoxID.contains(vBoxRecordId);
    }

}
